# vue< td > < router - link: to = "{'name':'update',query:{'id':i.id}}" > 修改 < / router - link > < / td >
# <td><a href="" @click.prevent="del(i.id)">删除</a></td>


# se
# STATICFILES_DIRS = (
#     os.path.join(BASE_DIR,'static'),
# )

# 富文本
# <script src="{% static 'js/jquery-1.10.2.min.js' %}"></script>
# <script src="{% static 'tinymce/js/tinymce/tinymce.min.js' %}"></script>
# <script src="{% static 'js/tinymce_setup.js' %}"></script>
# 继承
# < input
# id = "rich_content"
# name = "content"
# value = "" >
#
# {% extends 'base.html' %}
#
# {% block coutent %}
#
# {% endblock %}

# 正则
# if not re.match('^[A-Z]/d{8}$',password):
#     return HttpResponse('密码错误')
# 过滤器
# templatetags
# from django import template
# register = template.Library()
#
# def filter(res):
#     # res = int(res) * 0.8
#     res = '$' + str(res) + '元'
#     return res
#
# register.filter('yuan',filter)
# md5
# import hashlib
# def password_encrypt(pwd):
#     md5=hashlib.md5()
#     md5.update(pwd.encode())
#     result=md5.hexdigest()
#     return result
import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '(^%v$it9am#gr@#^2n5oahdgcit!hl3phng9g4g@yfim@tar!c'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'corsheaders',
    'rest_framework',
    'mdapp'
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'corsheaders.middleware.CorsMiddleware',  # 解决跨域问题，必须放在这个位置，加载顺序

    'django.middleware.common.CommonMiddleware',
    # 'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'mdapp.middleware.BlockedIPSMiddleware',  # 注册中间件

]

ROOT_URLCONF = 'mdpro.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'mdpro.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'USER':'root',
        'PASSWORD':'',
        'HOST':'127.0.0.1',
        'PORT':3306,
        'NAME':'a'

    }
}


# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR,'static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,"media")

CORS_ORIGIN_ALLOW_ALL=True  #所有站点均可跨域访问我
